<div class="login-form">
  <el-form
    ref="loginForm"
    v-loading="isSubmiting"
    :model="loginForm"
    :rules="loginRules"
  >
    <el-form-item prop="username">
      <el-input
        class="input-custom"
        v-model="loginForm.username"
        placeholder="请输入账号"
        @keyup.enter.native="$login"
        prefix-icon="el-icon-user"
        clearable>
      </el-input>
    </el-form-item>
    <el-form-item prop="password">
      <el-input
        class="input-custom"
        v-model="loginForm.password"
        :type="pwdType"
        placeholder="请输入密码"
        @keyup.enter.native="$login"
        prefix-icon="el-icon-lock"
        clearable>
        <i
          slot="suffix"
          class="el-input__icon"
          @click="pwdType === 'password' ? pwdType = 'text' : pwdType = 'password'"
          :class="pwdType === 'password' ? 'el-icon el-icon-view' : 'el-icon el-icon-view'"></i>
      </el-input>
    </el-form-item>
    <el-form-item>
      <el-button
        type="primary"
        class="btn"
        @click="$login"
        :icon="isSubmiting ? 'ui-icon-line-currency-loading' : ''"
        :disabled="loginForm.username && loginForm.password ? false : true"
      >
        登录
      </el-button>
    </el-form-item>
  </el-form>
</div>
